package org.micro.rbac.core.valid;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import org.micro.rbac.core.valid.validator.EnumConstraintValidator;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author hongsir
 * @apiNote 摘要:针对字符串校验枚举类型,校验器需要
 * @since 2019-05-29 09:08
 */
@Target({METHOD, FIELD, ANNOTATION_TYPE, PARAMETER})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {EnumConstraintValidator.class})
public @interface EnumConstraint {

    String message() default "枚举值异常";

    /**
     * 枚举class，不能为空
     */
    Class value();

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
